package cn.edu.xmu.datamining.tangzk.hadoop;

import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;

import org.apache.hadoop.io.Text;
import org.apache.hadoop.io.Writable;

public class PairWritable implements Writable {

	private int id1, id2;
	private Text text = new Text();

	public PairWritable() {

	}

	public PairWritable(int i, int j, String abc) {
		this.id1 = i;
		this.id2 = j;
		this.text.set(abc);
	}

	@Override
	public void readFields(DataInput in) throws IOException {
		this.id1 = in.readInt();
		this.id2 = in.readInt();
		text.readFields(in);
	}

	@Override
	public void write(DataOutput out) throws IOException {
		out.writeInt(this.id1);
		out.writeInt(this.id2);
		text.write(out);
	}

}
